//#include "bus.h"
#include "noc.h"
#include "CaffProc/processor.h"
#include "CaffCache/hash_table.h"
#include "CaffMC/memory.h"
//#include "mesh_interface.h"
#include "fakenet.h"
#include "network.h"
#include "uarch/sim.h"

extern Simulator Sim;
using namespace manifold::kernel;

Noc::Noc ()
{
}

Noc::~Noc ()
{
}

void Noc::build_fakenet (int num_nodes)
{
    Fakenet *fn;
    fn = new Fakenet (num_nodes);

    this->networks.push_front(fn);
    for(int i = 0; i < num_nodes; i++)
    {
        interface_cids[i] = fn->get_cid(i);
    }
}

CompId_t Noc::get_interface_cid_for_id (int id)
{
    return interface_cids[id];
}


void Noc::tick (void)
 {
     LIST <Network*>::iterator it;
     for (it = networks.begin(); it != networks.end(); it++)
     {
         (*it)->tick();
     }
 }
 
 void Noc::tock (void)
 {
     LIST <Network*>::iterator it;
     for (it = networks.begin(); it != networks.end(); it++)
     {
         (*it)->tock();
     }
 }
 

